<!DOCTYPE html>
<!--加这个标签以后才可以对model模型进行解析-->
<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title th:text="${sectionName + ' - PCF社区'}"></title>
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="/css/commnuity.css">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="/js/bootstrap.min.js" type="text/javascript"></script>
</head>
<body>
<!-- 导航栏部分引用 -->
<div th:insert="~{navigation :: nav}"></div>

<!-- 图标class glyphicon glyphicon-list -->
<nav class="navbar navbar-default">
    <div class="container-fluid profile" id="left_main">
        <div class="row">
            <!--左侧文章部分-->
            <!-- 我的问题部分 -->
            <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12" th:if="${section.equals('questions')}">
                <h2 th:text="${sectionName}"></h2>
                <!--/*@thymesVar id="info" type="com.xuan.forum.dto.QuestionDto"*/-->
                <div th:each="info,infoStat :${pagination.data}">
                    <div class="media" style="margin-top: 30px">
                        <div class="media-left media-middle">
                            <a href="#">
                                <img class="media-object img-rounded" style="width: 40px"
                                     th:src="${info.user.avatarUrl}" alt="..."/>
                            </a>
                        </div>
                        <div class="media-body">
                            <h4 class="media-heading" >
                                <a  th:text="${info.title}" th:href="@{'/question/'+ ${info.id} }"></a>
                            </h4>
<!--                            <br>-->
                            <span class="test_desc">
                        <span th:text="${info.commentCount}"></span>个回复 ·  <span th:text="${info.viewCout}"></span>次浏览 ·
                                问题发布时间<span
                                    th:text="${#dates.format(info.getDateByLong(info.gmtCreate), 'yyyy-mm-dd hh:mm:ss')}"></span> ·
                                最新评论时间<span
                                    th:text="${#dates.format(info.getDateByLong(info.gmtModified), 'yyyy-mm-dd hh:mm:ss')}"></span>
                        </span>   ·                     <!-- 编辑按钮开始 -->
                            <a th:href="@{'/publish/' + ${info.id} }" style="color: #999; font-size: 18px" th:if="${session.user != null && session.user.name == info.creator}">
                                <button type="button" class="btn btn-success profile_btn">编辑</button>
                            </a>
                        </div>

                        <!-- 编辑按钮结束 -->
                    </div>
                </div>
            </div>

            <!-- 最新回复部分 -->
            <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12" th:if="${section.equals('repiies')}">

                <div class="media" style="margin-top: 30px">
                    <!--/*@thymesVar id="notification" type="com.xuan.forum.dto.NotificationDto"*/-->
                    <div th:each="notification,notificationStat :${pagination.data}" >
                        <div class="media-body">
                            <h4 class="media-heading" >
                                <a th:text="${notification.notifier.name}"></a>
                                <span th:if="${notification.type == 1}">回复了问题</span>
                                <span th:if="${notification.type == 2}">回复了评论</span>
                                <a  th:if="${notification.type == 1}" th:href="@{'/notification/'+ ${notification.id}}" th:text="${notification.outerTitle}"></a>
                                <a  th:if="${notification.type == 2}" th:href="@{'/notification/'+ ${notification.id}}" th:text="${notification.outerTitle}"></a>
                                <span th:if="${notification.status == 0}" class="label label-danger">未读</span>
                            </h4>
                        </div>
                        <!--/*@thymesVar id="gmtCreate" type="java.lang.Long"*/-->
                        <span class="test_desc" th:text="${#dates.format(notification.gmtCreate, 'yyyy-mm-dd hh:mm:ss')}"></span>
                        <br>
                        <hr class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    </div>

                </div>
                <!--  判断有没有通知 -->
                <div th:if="${pagination.dataCount == 0}">
                    <h2>暂时没有通知</h2>
                </div>
            </div>
            <!-- 左边文章部分结束 -->

            <!-- 右侧选项部分 -->
            <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
                <div class="list-group section">
                    <a href="/profile/questions"
                       th:class="${section.equals('questions')} ? 'list-group-item active' : 'list-group-item' ">我的问题
<!--                        <span class="badge" th:text="${pagination.getDataCount()}"></span>-->
                    </a>
                    <a href="/profile/repiies"
                       th:class="${section.equals('repiies')} ? 'list-group-item active' : 'list-group-item' ">最新回复<span
                                class="badge" th:text="${unreadCount}"></span></a>
                    <a href="#" class="list-group-item">Morbi leo risus <span class="badge">14</span></a>
                </div>
            </div>
            <!-- 左边文章列表部分结束 -->
        </div>

        <!--  文章下方分页列表开始 -->
        <div class="row" style="margin: 0 auto">
            <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12" >
                <ul class="pagination">
                    <li th:if="${pagination.showFirsPage}" ><a th:href="@{'/profile/'  + ${section} + '?page=1'}">首页</a></li>
                    <li th:if="${pagination.showPrevious}" ><a th:href="@{'/profile/' + ${section} + '/?page=' + ${pagination.page -1} }" >上一页</a></li>

                    <li  th:each="info,infoState :${pagination.pages}" th:class="${pagination.page == info} ? 'active' : '' " >
                        <a th:href="@{'?page='+${info}}" th:text="${info}" ></a>
                    </li>
                    <li th:if="${pagination.showNext}"><a th:href="@{'/profile/' + ${section} + '?page=' + ${pagination.page +1} }" >下一页</a></li>
                    <li th:if="${pagination.showEndPage}"><a th:href="@{'/profile/' + ${section} + '?page=' + ${pagination.totalPage} }"  >末页</a></li>
                </ul>
            </div>
        </div>
        <!-- 文章下方分页列表结束 -->

    </div>
</nav>
<!-- 页尾部分引用 -->
<div class="footer" th:insert="~{footer :: foot}"></div>
</body>
</html>